package com.zmovie.framework.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zmovie.framework.domain.MovieComment;
import com.zmovie.framework.service.MovieCommentService;
import com.zmovie.framework.mapper.MovieCommentMapper;
import org.springframework.stereotype.Service;

/**
 * @author lenovo
 * @description 针对表【movie_comment】的数据库操作Service实现
 * @createDate 2023-11-30 12:27:50
 */
@Service
public class MovieCommentServiceImpl extends ServiceImpl<MovieCommentMapper, MovieComment>
        implements MovieCommentService {

    @Override
    public Page<MovieComment> pageMovieComment(MovieComment movieComment, Integer pageNo, Integer pageSize) {
        LambdaQueryWrapper<MovieComment> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(movieComment.getMovieId() != null, MovieComment::getMovieId, movieComment.getMovieId());
        wrapper.orderByAsc(MovieComment::getId);
        Page<MovieComment> commentPage = new Page<>(pageNo, pageSize);
        return page(commentPage, wrapper);
    }
}




